<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>我的拼团-拼团商城</title>
    <style>
        body {
            margin: 0;
            padding: 30px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
            background: linear-gradient(to bottom right, #f3f4f6, #e2e8f0);
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            animation: fadeInUp 0.6s ease-out;
        }
        h2 {
            text-align: center;
            margin-bottom: 30px;
        }
        .card {
            background: #fff;
            padding: 20px;
            margin-bottom: 15px;
            border-radius: 16px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.06);
            transition: transform 0.2s;
        }
        .card:hover {
            transform: scale(1.01);
        }
        .card-title {
            font-weight: bold;
            font-size: 16px;
        }
        .card-desc {
            color: #666;
            font-size: 14px;
        }
        .card a {
            display: inline-block;
            margin-top: 12px;
            text-decoration: none;
            color: #667eea;
        }
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
<div class="container" style="max-width: 900px; margin: 30px auto; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">

    <!-- 顶部导航 -->
    <div style="background: white; padding: 16px 40px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 12px rgba(0,0,0,0.05); border-radius: 0 0 20px 20px;">
        <!-- 左侧导航链接 -->
        <div>
            <a href="${pageContext.request.contextPath}/front/products" style="margin: 0 12px; text-decoration: none; color: #333;">商品浏览</a>
            <a href="${pageContext.request.contextPath}/front/cart" style="margin: 0 12px; text-decoration: none; color: #333;">购物车</a>
            <a href="${pageContext.request.contextPath}/front/order/my" style="margin: 0 12px; text-decoration: none; color: #333;">我的订单</a>
            <a href="${pageContext.request.contextPath}/front/group/my" style="margin: 0 12px; text-decoration: none; color: #333;">我的拼团</a>
        </div>

        <!-- 右侧退出登录 -->
        <div>
            <a href="${pageContext.request.contextPath}/front/login"
               style="padding: 8px 16px; background: linear-gradient(135deg, #c3aed6, #a393eb); color: white; border-radius: 12px; text-decoration: none; transition: all 0.3s ease;">
                退出登录
            </a>
        </div>
    </div>
    <c:if test="${empty groupList}">
        <p style="margin-top: 40px; text-align: center; color: #666;">你还没有参与任何拼团哦～</p>
    </c:if>

    <c:forEach var="group" items="${groupList}">
        <div class="card" style="background: #fff; border-radius: 12px; padding: 20px; margin: 24px 0; box-shadow: 0 8px 15px rgba(0,0,0,0.1); transition: transform 0.3s ease;">
            <div class="card-title" style="font-size: 22px; font-weight: 700; color: #5a3e99; margin-bottom: 12px;">
                    ${group.product.name}
                <c:if test="${group.isInitiator}">
                    <span style="font-size: 14px; color: #fff; background: #764ba2; padding: 2px 8px; border-radius: 10px; margin-left: 12px;">发起人</span>
                </c:if>
            </div>

            <div class="card-desc" style="font-size: 14px; color: #888; margin-bottom: 16px;">
                发起时间：
                <fmt:formatDate value="${group.joinedAt}" pattern="yyyy-MM-dd HH:mm:ss"/>
                &nbsp; | &nbsp;
                拼团人数：${group.currentSize} / ${group.groupSize}
            </div>

            <a href="${pageContext.request.contextPath}/front/group/detail?id=${group.activityId}"
               style="display: inline-block; padding: 10px 20px; background: linear-gradient(45deg, #764ba2, #667eea);
                      color: #fff; text-decoration: none; border-radius: 25px; font-weight: 600; transition: background 0.3s ease;">
                查看详情
            </a>
        </div>
    </c:forEach>
</div>

<style>
    .card:hover {
        transform: translateY(-6px);
        box-shadow: 0 15px 25px rgba(118,75,162,0.3);
    }
</style>
</body>
</html>